//
//  ICMProxyMaintenanceAndPartsView.h
//  ICrEAM
//
//  Created by Cty on 2016/11/03.
//  Copyright © 2016年 mac. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ICMTitleTextFeildView.h"
#import "ICMProxyBasicInfoModel.h"
#import "ICMRepairMaintenanceModel.h"
#import "ICMRepairPartsModel.h"
#import "ICMStationModel.h"

@class ICMRepairMaintenancesModel,ICMRepairPartsArrayModel,ICMProxyBasicInfoModel,ICMRepairPartsModel,ICMRepairMaintenanceModel;

@protocol ICMProxyMaintenanceAndPartsViewDelegate <NSObject>
@optional
- (void)showRepairEventAndSearchViewWithRepairType:(NSString *)repairType;

@end


@interface ICMProxyMaintenanceAndPartsView : UIView<UIAlertViewDelegate>
@property (nonatomic, strong)ICMRepairPartsArrayModel *repairPartsArrayModel;
@property (nonatomic, strong)ICMRepairMaintenancesModel *repairMaintenancesModel;
@property (nonatomic, strong)ICMStationModel *stationModel;
@property (nonatomic, strong) ICMTitleTextFeildView *workingUnitPriceView;//工时单价
@property (nonatomic, strong) ICMTitleTextFeildView *workingPriceView;//工时费
@property (nonatomic, strong) ICMTitleTextFeildView *partsPriceView;//零件费
@property (nonatomic, strong) ICMTitleTextFeildView *totalPriceView;//总金额


@property (nonatomic, strong) ICMTitleTextFeildView *workingRatioView;//工时折扣率
@property (nonatomic, strong) ICMTitleTextFeildView *partsRatioView;//零件折扣率
@property (nonatomic, strong) ICMTitleTextFeildView *discountedPrice;//折后总金额

@property (nonatomic, strong) ICMTitleTextFeildView *finishTimeView;

@property (nonatomic, weak) id<ICMProxyMaintenanceAndPartsViewDelegate> delegate;//代理

@property (nonatomic, strong) NSMutableArray *repairEventArray;//维修项目数组
//@property (nonatomic, strong) NSMutableArray *stationArray;//维修项目数组
@property (nonatomic, strong) NSMutableArray *repairPartsArray;//维修零件数组

@property (nonatomic, strong) NSMutableArray *repairTypes;//所有维修类型

@property (nonatomic, strong) NSMutableArray *delRepairEventArray;//被删除的项目
@property (nonatomic, strong) NSMutableArray *delRepairPartsArray;//被删除的零件

//根据活动里面项目和零件  和   项目和零件  生成对应关系数据字典
@property (nonatomic, strong) NSMutableDictionary *labourAndPartsExistDic;

- (void)resetRepairTypeButton;

@property (nonatomic, strong) NSString *modelCode;//查询时要传车型
@property (nonatomic, strong) NSString *SERIES_LABOUR_PRICE;//车系单价
//选中需要删除的零件或项目index
@property (nonatomic, assign) NSInteger wishDeleteIndex;
 
+ (instancetype)createICMMaintenanceAndPartsViewWithFrame:(CGRect)frame;

//编辑模式调用
//- (void)setupPartsViewWithPartsTopModel:(ICMPartsTopModel*)topModel;
- (void)setupPartsViewWithBasicModel:(ICMProxyBasicInfoModel *)basicModel;
- (void)setupPartsViewWithRepairMaintenancesModel:(ICMRepairMaintenancesModel*)repairMaintenancesModel;
- (void)setupPartsViewWithRepairPartsArrayModel:(ICMRepairPartsArrayModel*)repairPartsArrayModel;
- (void)refreshInEditType;

//活动里项目变更
- (void)proxyActivityLabourChangedWithModel:(ICMRepairMaintenanceModel *)model IsSelected:(BOOL)isSelected;
//活动里零件变更
- (void)proxyActivityPartChanged:(ICMRepairPartsModel *)model IsSelected:(BOOL)isSelected;

//界面值是否改变
@property (nonatomic, assign) BOOL hasViewValueChanged;

@end
